<template>
	<view class="news">
		<news-item @itemClick="goDetail" :newsList="newsList"></news-item>
	</view>
</template>

<script>
	import newsItem from "../../components/news-item/news-item.vue"
	export default {
		data() {
			return {
				newsList:[]
			}
		},
		methods: {
			//获得热门作品
			async getNewsList(){
				const res = await this.$myRequest({
					url: "/news/getNewsList"
				})
				console.log("res#getNewsList:" + res);
				this.newsList = res.data;
			},
			goDetail(id){
					console.log("clid"+id);
				uni.navigateTo({
				    url: '/pages/news-detail/news-detail?id='+id
				});
			}
		},
		components:{
			"news-item":newsItem
		},
		onLoad(){
			this.getNewsList();
		}
	}
</script>

<style lang="scss">
.news{
	.news_item{
		display: flex;
		padding: 10rpx;
		border-bottom: 1px solid $shop-color;
		image{
			width: 30%;
			height: 150rpx;
		}
		.right{
			margin-left: 15rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.tit{
				font-size: 30rpx;
			}
			.info{
				font-size: 24rpx;
				text:nth-child(2){
					margin-left:20rpx ;
				}
			}
		}
		
	}
}
</style>
